<?php
error_reporting(0);

class database
{
        private             $server;
        private             $username;
        private             $password;
        private             $database;
        private             $connection;
        
        function __construct()
        {
                $this->server               = "localhost";
                $this->username             = "root";
                $this->password             = "";
                $this->database             = "db_ocims";
                $this->connect();
        }
        
        private function connect()
        {
                $this->connection = mysql_connect($this->server, $this->username, $this->password) or die("Unable to establish connection to server!");
                mysql_select_db($this->database) or die("Unable to select database!");
                
                return $this->connection;
        }
        
        public function query($sql)
        {
                try
                {
                        return(mysql_query($sql, $this->connect()));
                }
                catch(Exception $e)
                {
                        throw($e);
                }
        }
}

?>